<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../react18/react.development.js"></script>
    <script src="../react18/react-dom.development.js"></script>
    <script src="../react18/babel.min.js"></script>
</head>

<body>
    <div id="app"></div>
    <script type="text/babel">
        //函数式组件
        function Content (){
            //返回虚拟DOM
            return <h1>标题</h1>
        }

        //类式组件
        class Title extends React.Component{
            //返回虚拟DOM
            render(){
                return <p>我是段落</p>
            }
        }

        //汇总功能的类式组件一般命名为App
        class App extends React.Component{
            render (){
                //可以直接渲染不同功能的组件
                return (
                    //必须有且仅有一层父类包裹
                    <div>
                        <Content />
                        <hr />
                        <Title />
                    </div>
                )
            }
        }

        const root = ReactDOM.createRoot(document.getElementById("app"))
        // 组件的返回值???
        root.render(<App />)

    </script>
</body>

</html>